Determine Whether a Joystick Event Is Triggered
Function:
magicbox.is_joystick_button(port, index)Description: determine whether a joystick event is triggered
Required parameter:
- port: controller port, data type: int, range: 1~6
- index: type of joystick event, range: magicbox.BTN_UP, magicbox.BTN_DOWN, magicbox.BTN_LEFT, magicbox.BTN_RIGHT, magicbox.BTN_MIDDLE
- Return:
- True: The event has been triggered.
- False: The event has not been triggered.
Example
magicbox.is_joystick_button(port=2, index=magicbox.BTN_DOWN)Detect the joystick module connected to Port 2 of controller, and determine whether BTN_DOWN event is triggered.